package cn.mesmile.activity.listener1;

import org.activiti.bpmn.model.FlowElement;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zb
 * @date 2022/1/5 10:20
 * @Description  多实例监听设置审批人
 *      【execution listeners】
 *
 *       【 Listener implementation  ${usingDepMultipleInstListener}
 *           type                     delegateExpression
 *           event                    take
 *        】
 */
@Component
public class UsingDepMultipleInstListener implements ExecutionListener {

    @Override
    public void notify(DelegateExecution execution){
        //模拟在数据库里查出会签的用户名把用户放到Variable
        List<String> assigneeList=new ArrayList();
        FlowElement currentFlowElement = execution.getCurrentFlowElement();

        assigneeList.add("zhangshan");
        assigneeList.add("lisi");
        execution.setVariable("assigneeList", assigneeList);
    }




}
